package io.ooad.jenkins.shuren;

import com.fasterxml.jackson.databind.JsonNode;
import retrofit2.Response;

import java.io.IOException;

/**
 * Created by yyang on 2017/1/3.
 */
public class UpdateAppCommand extends BaseCommand {

    private String aid;

    private JsonNode appInfo;

    public UpdateAppCommand(ShurenyunService service, String aid, JsonNode appInfo) {
        super(service);
        this.aid = aid;
        this.appInfo = appInfo;
    }

    @Override
    public Response<JsonNode> execute() {
        try {
            return getService().updateApp(aid, appInfo).execute();
        } catch (IOException e) {
            throw new RuntimeException("更新应用失败", e);
        }
    }
}
